//
//  VideoViewController.m
//  XMDLearn
//
//  Created by hao on 16/4/8.
//  Copyright © 2016年 hao. All rights reserved.
//

#import "VideoViewController.h"
#import "VideoTableViewCell.h"
#import "VideoPlayViewController.h"
@interface VideoViewController ()
@property (weak, nonatomic) IBOutlet UITableView *videoTableView;

@end

@implementation VideoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _videoTableView.rowHeight = 100;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *cellIdentifier = @"videoIdentifier";
    
    BOOL isRegister = NO;
    if(!isRegister){
        UINib *nib = [UINib nibWithNibName:@"VideoCell" bundle:nil];
        [tableView registerNib:nib forCellReuseIdentifier:cellIdentifier];
        isRegister = YES;
    }
    
    VideoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    if (cell == nil) {
        cell = [[VideoTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return  cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    self.hidesBottomBarWhenPushed=YES;
    VideoPlayViewController *videoPlay = [[VideoPlayViewController alloc]init];
    [self.navigationController pushViewController:videoPlay animated:YES];
    self.hidesBottomBarWhenPushed=NO;
}
@end
